#include<iostream>
using namespace std;
int prime(int x)
{   
    if(x < 2) return 0;
    for(int i = 2; i * i <= x; i ++)
    {
        if(x % i == 0) return 0;
    }
    return 1;
}
int main()
{
    int n; cin >> n; // 1 <= n <= 1e5;
    int sum = 0, count = 0;
    if(n < 2) cout << 0 << endl;
    else if(n == 2) cout << 2 << endl << 1 << endl;
    else
    {
        for(int i = 2;; i++)
        {
            if(prime(i))
            {
                if(sum + i > n) break;

                cout << i << endl;
                sum += i;
                count ++;
            }
        }
        cout << count << endl;
    }
    return 0;
}